package com.shop.loan.controller;

import com.shop.loan.annotation.LoginAuth;
import com.shop.loan.model.common.Constant;
import com.shop.loan.model.common.ResResult;
import com.shop.loan.model.vo.PayVo;
import com.shop.loan.service.PayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import javax.annotation.Resource;

@Api(value = "支付模块", tags = "支付模块")
@RestController
@RequestMapping(Constant.appPrefex + "/pay")
public class PayController {

    @Resource
    PayService payService;


    @LoginAuth
    @ApiOperation("创建支付订单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "int"),
    })
    @PostMapping("/pay")
    public ResResult pay(@ApiIgnore PayVo payVo) {
        return payService.readyPay(payVo, false);
    }


}
